<!-- This comment will put IE 6, 7 and 8 in quirks mode -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>eCommerce: Plik źródłowy D:/CentrumXP/e-Commerce/eCommerceDev/SklepDAO/NewsLetterDAO.cs</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javaScript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Wygenerowano przez Doxygen 1.6.1 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Szukaj');
--></script>
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Strona&nbsp;główna</span></a></li>
      <li><a href="namespaces.html"><span>Pakiety</span></a></li>
      <li><a href="annotated.html"><span>Klasy</span></a></li>
      <li class="current"><a href="files.html"><span>Pliki</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <img id="MSearchSelect" src="search/search.png"
             onmouseover="return searchBox.OnSearchSelectShow()"
             onmouseout="return searchBox.OnSearchSelectHide()"
             alt=""/>
        <input type="text" id="MSearchField" value="Szukaj" accesskey="S"
             onfocus="searchBox.OnSearchFieldFocus(true)" 
             onblur="searchBox.OnSearchFieldFocus(false)" 
             onkeyup="searchBox.OnSearchFieldChange(event)"/>
        <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
        </div>
      </li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>Lista&nbsp;plików</span></a></li>
      <li><a href="globals.html"><span>Składowe&nbsp;plików</span></a></li>
    </ul>
  </div>
<h1>D:/CentrumXP/e-Commerce/eCommerceDev/SklepDAO/NewsLetterDAO.cs</h1><a href="_news_letter_d_a_o_8cs.html">Idź do dokumentacji tego pliku.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a><a class="code" href="_news_letter_d_a_o_8cs.html#a81a223a02c34d82b47199f08308847f2">00001</a> ﻿using <a class="code" href="_common_tools_8cs.html#a81a223a02c34d82b47199f08308847f2">System</a>;
<a name="l00002"></a>00002 <span class="keyword">using</span> <a class="code" href="_common_tools_8cs.html#a81a223a02c34d82b47199f08308847f2">System</a>.Collections.Generic;
<a name="l00003"></a>00003 <span class="keyword">using</span> <a class="code" href="_common_tools_8cs.html#a81a223a02c34d82b47199f08308847f2">System</a>.Text;
<a name="l00004"></a>00004 <span class="keyword">using</span> ShopModel;
<a name="l00005"></a>00005 <span class="keyword">using</span> <a class="code" href="_common_tools_8cs.html#a81a223a02c34d82b47199f08308847f2">System</a>.Data;
<a name="l00006"></a>00006 <span class="keyword">using</span> <a class="code" href="_common_tools_8cs.html#a81a223a02c34d82b47199f08308847f2">System</a>.Data.SqlClient;
<a name="l00007"></a>00007 
<a name="l00008"></a>00008 
<a name="l00009"></a>00009 <span class="keyword">namespace </span>ShopDAO
<a name="l00010"></a>00010 {
<a name="l00011"></a><a class="code" href="class_shop_d_a_o_1_1_newsletter_d_a_o.html">00011</a>     <span class="keyword">public</span> <span class="keyword">class </span><a class="code" href="class_shop_d_a_o_1_1_newsletter_d_a_o.html">NewsletterDAO</a>
<a name="l00012"></a>00012     {
<a name="l00013"></a>00013 
<a name="l00014"></a>00014         <span class="keyword">private</span> <span class="keywordtype">string</span> connectionString;
<a name="l00015"></a>00015 
<a name="l00016"></a>00016         <span class="keyword">private</span> SqlConnection Connection()
<a name="l00017"></a>00017         {
<a name="l00018"></a>00018             <span class="keywordflow">return</span> <span class="keyword">new</span> SqlConnection(connectionString);
<a name="l00019"></a>00019         }
<a name="l00020"></a>00020 
<a name="l00021"></a><a class="code" href="class_shop_d_a_o_1_1_newsletter_d_a_o.html#aa1ac437a09e8667dc8343629358fd6af">00021</a>         <span class="keyword">public</span> <a class="code" href="class_shop_d_a_o_1_1_newsletter_d_a_o.html#aa1ac437a09e8667dc8343629358fd6af">NewsletterDAO</a>()
<a name="l00022"></a>00022         {
<a name="l00023"></a>00023             connectionString = <a class="code" href="_common_tools_8cs.html#a81a223a02c34d82b47199f08308847f2">System</a>.Configuration.ConfigurationManager.ConnectionStrings[<span class="stringliteral">&quot;csShop&quot;</span>].ConnectionString;
<a name="l00024"></a>00024         }
<a name="l00025"></a>00025 
<a name="l00032"></a><a class="code" href="class_shop_d_a_o_1_1_newsletter_d_a_o.html#a8ae2674a337e27d35874e4d15e928188">00032</a>         <span class="keyword">public</span> <a class="code" href="class_shop_model_1_1_newsletter.html" title="Klasa przechowująca informacje o biuletynie (Newsletter) wysyłanym do użytkowników...">Newsletter</a> <a class="code" href="class_shop_d_a_o_1_1_newsletter_d_a_o.html#a8ae2674a337e27d35874e4d15e928188" title="Pobiera subskrypcję w oparciu o jej id(Downloads newsletter on the basis of its...">GetNewsletter</a>(<span class="keywordtype">int</span> NewsletterID, <span class="keywordtype">int</span>? LanguageID)
<a name="l00033"></a>00033         {
<a name="l00034"></a>00034             SqlConnection sqlC = Connection();
<a name="l00035"></a>00035             SqlCommand command = sqlC.CreateCommand();
<a name="l00036"></a>00036             SqlDataReader sqlR;
<a name="l00037"></a>00037             <a class="code" href="class_shop_model_1_1_newsletter.html" title="Klasa przechowująca informacje o biuletynie (Newsletter) wysyłanym do użytkowników...">Newsletter</a> result = null;
<a name="l00038"></a>00038 
<a name="l00039"></a>00039             command.CommandText = <span class="stringliteral">&quot;GetNewsletter&quot;</span>;
<a name="l00040"></a>00040             command.CommandType = CommandType.StoredProcedure;
<a name="l00041"></a>00041 
<a name="l00042"></a>00042             command.Parameters.Add(<span class="keyword">new</span> SqlParameter(<span class="stringliteral">&quot;@IdNewsletter&quot;</span>, NewsletterID));
<a name="l00043"></a>00043             command.Parameters.Add(<span class="keyword">new</span> SqlParameter(<span class="stringliteral">&quot;@LanguageID&quot;</span>, LanguageID));
<a name="l00044"></a>00044 
<a name="l00045"></a>00045             <span class="keywordflow">try</span>
<a name="l00046"></a>00046             {
<a name="l00047"></a>00047                 sqlC.Open();
<a name="l00048"></a>00048                 sqlR = command.ExecuteReader();
<a name="l00049"></a>00049 
<a name="l00050"></a>00050                 <span class="keywordflow">if</span> (sqlR.Read())
<a name="l00051"></a>00051                 {
<a name="l00052"></a>00052                     result = <span class="keyword">new</span> <a class="code" href="class_shop_model_1_1_newsletter.html" title="Klasa przechowująca informacje o biuletynie (Newsletter) wysyłanym do użytkowników...">Newsletter</a>((<span class="keywordtype">int</span>)sqlR[<span class="stringliteral">&quot;IdNewsletter&quot;</span>], (<span class="keywordtype">string</span>)sqlR[<span class="stringliteral">&quot;Title&quot;</span>], (<span class="keywordtype">string</span>)sqlR[<span class="stringliteral">&quot;Description&quot;</span>], (<span class="keywordtype">string</span>)sqlR[<span class="stringliteral">&quot;Content&quot;</span>], (DateTime)sqlR[<span class="stringliteral">&quot;NewsDate&quot;</span>], (DateTime)sqlR[<span class="stringliteral">&quot;NewsDateSend&quot;</span>], (<span class="keywordtype">bool</span>)sqlR[<span class="stringliteral">&quot;IsSent&quot;</span>]);
<a name="l00053"></a>00053                 }
<a name="l00054"></a>00054 
<a name="l00055"></a>00055                 sqlR.Close();
<a name="l00056"></a>00056             }
<a name="l00057"></a>00057             <span class="keywordflow">catch</span> (Exception ex)
<a name="l00058"></a>00058             {
<a name="l00059"></a>00059                 ErrorLogger.LogError(ex);
<a name="l00060"></a>00060             }
<a name="l00061"></a>00061             <span class="keywordflow">finally</span>
<a name="l00062"></a>00062             { sqlC.Close(); }
<a name="l00063"></a>00063 
<a name="l00064"></a>00064             <span class="keywordflow">return</span> result;
<a name="l00065"></a>00065         }
<a name="l00066"></a>00066 
<a name="l00073"></a><a class="code" href="class_shop_d_a_o_1_1_newsletter_d_a_o.html#aed8e70c64e787c7a5d670cdf58b2bad6">00073</a>         <span class="keyword">public</span> <span class="keywordtype">int</span> <a class="code" href="class_shop_d_a_o_1_1_newsletter_d_a_o.html#aed8e70c64e787c7a5d670cdf58b2bad6" title="Zapisuje treść biuletynu, jeśli istnieje uaktualnia(Saves new newsletter, updates...">SaveNewsletter</a>(<a class="code" href="class_shop_model_1_1_newsletter.html" title="Klasa przechowująca informacje o biuletynie (Newsletter) wysyłanym do użytkowników...">Newsletter</a> NewsletterToSave, <span class="keywordtype">int</span>? LanguageID)
<a name="l00074"></a>00074         {
<a name="l00075"></a>00075             SqlConnection sqlC = Connection();
<a name="l00076"></a>00076             SqlCommand command = sqlC.CreateCommand();
<a name="l00077"></a>00077             SqlDataReader sqlR;
<a name="l00078"></a>00078 
<a name="l00079"></a>00079             <span class="keywordtype">int</span> result = -1;
<a name="l00080"></a>00080 
<a name="l00081"></a>00081             command.CommandText = <span class="stringliteral">&quot;SaveNewsletter&quot;</span>;
<a name="l00082"></a>00082             command.CommandType = CommandType.StoredProcedure;
<a name="l00083"></a>00083 
<a name="l00084"></a>00084             command.Parameters.Add(<span class="keyword">new</span> SqlParameter(<span class="stringliteral">&quot;@IDnewsLetter&quot;</span>, NewsletterToSave.<a class="code" href="class_shop_model_1_1_news.html#a271fbd0dc64d101cba1763cfbb6fc2f9">NewsID</a>));
<a name="l00085"></a>00085             command.Parameters.Add(<span class="keyword">new</span> SqlParameter(<span class="stringliteral">&quot;@Title&quot;</span>, NewsletterToSave.<a class="code" href="class_shop_model_1_1_news.html#a9ed7b9bc92bb938f89e0f117636c51e7">Title</a>));
<a name="l00086"></a>00086             command.Parameters.Add(<span class="keyword">new</span> SqlParameter(<span class="stringliteral">&quot;@Description&quot;</span>, NewsletterToSave.<a class="code" href="class_shop_model_1_1_news.html#a56c8d9dd184d6384e450aeb42cc937dc">Description</a>));
<a name="l00087"></a>00087             command.Parameters.Add(<span class="keyword">new</span> SqlParameter(<span class="stringliteral">&quot;@Content&quot;</span>, NewsletterToSave.<a class="code" href="class_shop_model_1_1_news.html#a6109c0e8f855f0a1eff72e69f21314f3">Content</a>));
<a name="l00088"></a>00088             command.Parameters.Add(<span class="keyword">new</span> SqlParameter(<span class="stringliteral">&quot;@NewsDate&quot;</span>, NewsletterToSave.<a class="code" href="class_shop_model_1_1_news.html#a4684351ed21ce44a8d56c8eb08715342">NewsDate</a>));
<a name="l00089"></a>00089             command.Parameters.Add(<span class="keyword">new</span> SqlParameter(<span class="stringliteral">&quot;@NewsDateSend&quot;</span>, NewsletterToSave.<a class="code" href="class_shop_model_1_1_newsletter.html#a94a9008b9f102e2eec467d42d87ce623">NewsDateSend</a>));
<a name="l00090"></a>00090             command.Parameters.Add(<span class="keyword">new</span> SqlParameter(<span class="stringliteral">&quot;@LanguageID&quot;</span>, LanguageID));
<a name="l00091"></a>00091             command.Parameters.Add(<span class="keyword">new</span> SqlParameter(<span class="stringliteral">&quot;@IsSent&quot;</span>, NewsletterToSave.<a class="code" href="class_shop_model_1_1_newsletter.html#af02561d49b5049d8901b1adb8fd297e6">IsSent</a>));
<a name="l00092"></a>00092 
<a name="l00093"></a>00093             <span class="keywordflow">try</span>
<a name="l00094"></a>00094             {
<a name="l00095"></a>00095                 sqlC.Open();
<a name="l00096"></a>00096                 sqlR = command.ExecuteReader();
<a name="l00097"></a>00097 
<a name="l00098"></a>00098                 <span class="keywordflow">if</span> (sqlR.Read())
<a name="l00099"></a>00099                     result = (<span class="keywordtype">int</span>)sqlR[<span class="stringliteral">&quot;NewsID&quot;</span>];
<a name="l00100"></a>00100 
<a name="l00101"></a>00101                 sqlR.Close();
<a name="l00102"></a>00102             }
<a name="l00103"></a>00103             <span class="keywordflow">catch</span> (Exception ex)
<a name="l00104"></a>00104             {
<a name="l00105"></a>00105                 ErrorLogger.LogError(ex);
<a name="l00106"></a>00106             }
<a name="l00107"></a>00107             <span class="keywordflow">finally</span>
<a name="l00108"></a>00108             { sqlC.Close(); }
<a name="l00109"></a>00109 
<a name="l00110"></a>00110             <span class="keywordflow">return</span> result;
<a name="l00111"></a>00111         }
<a name="l00112"></a>00112 
<a name="l00118"></a><a class="code" href="class_shop_d_a_o_1_1_newsletter_d_a_o.html#a969d1c5ffa29ebfc1f5835fa5504285c">00118</a>         <span class="keyword">public</span> <span class="keywordtype">bool</span> <a class="code" href="class_shop_d_a_o_1_1_newsletter_d_a_o.html#a969d1c5ffa29ebfc1f5835fa5504285c" title="Usuwa biuletyn z tabeli (Deletes newsletter from table.).">DeleteNewsletter</a>(<span class="keywordtype">int</span> NewsletterID)
<a name="l00119"></a>00119         {
<a name="l00120"></a>00120             SqlConnection sqlC = Connection();
<a name="l00121"></a>00121             SqlCommand command = sqlC.CreateCommand();
<a name="l00122"></a>00122             <span class="keywordtype">bool</span> result = <span class="keyword">false</span>;
<a name="l00123"></a>00123 
<a name="l00124"></a>00124             command.CommandText = <span class="stringliteral">&quot;DeleteNewsletter&quot;</span>;
<a name="l00125"></a>00125             command.CommandType = CommandType.StoredProcedure;
<a name="l00126"></a>00126 
<a name="l00127"></a>00127             command.Parameters.Add(<span class="keyword">new</span> SqlParameter(<span class="stringliteral">&quot;@IdNewsletter&quot;</span>, NewsletterID));
<a name="l00128"></a>00128 
<a name="l00129"></a>00129             <span class="keywordflow">try</span>
<a name="l00130"></a>00130             {
<a name="l00131"></a>00131                 sqlC.Open();
<a name="l00132"></a>00132                 <span class="keywordtype">int</span> rows = command.ExecuteNonQuery();
<a name="l00133"></a>00133 
<a name="l00134"></a>00134                 <span class="keywordflow">if</span> (rows &gt; 0)
<a name="l00135"></a>00135                     result = <span class="keyword">true</span>;
<a name="l00136"></a>00136             }
<a name="l00137"></a>00137             <span class="keywordflow">catch</span> (Exception ex)
<a name="l00138"></a>00138             {
<a name="l00139"></a>00139                 ErrorLogger.LogError(ex);
<a name="l00140"></a>00140             }
<a name="l00141"></a>00141             <span class="keywordflow">finally</span>
<a name="l00142"></a>00142             { sqlC.Close(); }
<a name="l00143"></a>00143 
<a name="l00144"></a>00144             <span class="keywordflow">return</span> result;
<a name="l00145"></a>00145         }
<a name="l00146"></a>00146 
<a name="l00153"></a><a class="code" href="class_shop_d_a_o_1_1_newsletter_d_a_o.html#ae818301e8c4c2881bc28d439d79dc266">00153</a>         <span class="keyword">public</span> <span class="keywordtype">bool</span> <a class="code" href="class_shop_d_a_o_1_1_newsletter_d_a_o.html#ae818301e8c4c2881bc28d439d79dc266" title="Usuwa mail urzytkownika z tabeli maili oczekujących na wysłanie (Deletes user’s...">DeleteNewsletterEmail</a>(<span class="keywordtype">int</span> NewsletterID, <span class="keywordtype">string</span> Email)
<a name="l00154"></a>00154         {
<a name="l00155"></a>00155             SqlConnection sqlC = Connection();
<a name="l00156"></a>00156             SqlCommand command = sqlC.CreateCommand();
<a name="l00157"></a>00157             <span class="keywordtype">bool</span> result = <span class="keyword">false</span>;
<a name="l00158"></a>00158 
<a name="l00159"></a>00159             command.CommandText = <span class="stringliteral">&quot;DeleteNewsletterEmail&quot;</span>;
<a name="l00160"></a>00160             command.CommandType = CommandType.StoredProcedure;
<a name="l00161"></a>00161 
<a name="l00162"></a>00162             command.Parameters.Add(<span class="keyword">new</span> SqlParameter(<span class="stringliteral">&quot;@NewsletterID&quot;</span>, NewsletterID));
<a name="l00163"></a>00163             command.Parameters.Add(<span class="keyword">new</span> SqlParameter(<span class="stringliteral">&quot;@Email&quot;</span>, Email));
<a name="l00164"></a>00164 
<a name="l00165"></a>00165             <span class="keywordflow">try</span>
<a name="l00166"></a>00166             {
<a name="l00167"></a>00167                 sqlC.Open();
<a name="l00168"></a>00168                 <span class="keywordtype">int</span> rows = command.ExecuteNonQuery();
<a name="l00169"></a>00169 
<a name="l00170"></a>00170                 <span class="keywordflow">if</span> (rows &gt; 0)
<a name="l00171"></a>00171                     result = <span class="keyword">true</span>;
<a name="l00172"></a>00172             }
<a name="l00173"></a>00173             <span class="keywordflow">catch</span> (Exception ex)
<a name="l00174"></a>00174             {
<a name="l00175"></a>00175                 ErrorLogger.LogError(ex);
<a name="l00176"></a>00176             }
<a name="l00177"></a>00177             <span class="keywordflow">finally</span>
<a name="l00178"></a>00178             { sqlC.Close(); }
<a name="l00179"></a>00179 
<a name="l00180"></a>00180             <span class="keywordflow">return</span> result;
<a name="l00181"></a>00181         }
<a name="l00182"></a>00182 
<a name="l00188"></a><a class="code" href="class_shop_d_a_o_1_1_newsletter_d_a_o.html#ad77ddd43f08250934e921644d54aa1bd">00188</a>         <span class="keyword">public</span> List&lt;Newsletter&gt; <a class="code" href="class_shop_d_a_o_1_1_newsletter_d_a_o.html#ad77ddd43f08250934e921644d54aa1bd" title="Pobiera wszystkie subskrypcje z tabeli NewsLetter (Downloads all the news from the...">GetNewsletters</a>(<span class="keywordtype">int</span>? LanguageID)
<a name="l00189"></a>00189         {
<a name="l00190"></a>00190             SqlConnection sqlC = Connection();
<a name="l00191"></a>00191             SqlCommand command = sqlC.CreateCommand();
<a name="l00192"></a>00192             SqlDataReader sqlR;
<a name="l00193"></a>00193             List&lt;Newsletter&gt; result = <span class="keyword">new</span> List&lt;Newsletter&gt;();
<a name="l00194"></a>00194 
<a name="l00195"></a>00195             command.CommandText = <span class="stringliteral">&quot;GetNewsletter&quot;</span>;
<a name="l00196"></a>00196             command.CommandType = CommandType.StoredProcedure;
<a name="l00197"></a>00197 
<a name="l00198"></a>00198             command.Parameters.Add(<span class="keyword">new</span> SqlParameter(<span class="stringliteral">&quot;@LanguageID&quot;</span>, LanguageID));
<a name="l00199"></a>00199 
<a name="l00200"></a>00200             <span class="keywordflow">try</span>
<a name="l00201"></a>00201             {
<a name="l00202"></a>00202                 sqlC.Open();
<a name="l00203"></a>00203                 sqlR = command.ExecuteReader();
<a name="l00204"></a>00204 
<a name="l00205"></a>00205                 <span class="keywordflow">while</span> (sqlR.Read())
<a name="l00206"></a>00206                 {
<a name="l00207"></a>00207                     result.Add(<span class="keyword">new</span> <a class="code" href="class_shop_model_1_1_newsletter.html" title="Klasa przechowująca informacje o biuletynie (Newsletter) wysyłanym do użytkowników...">Newsletter</a>((<span class="keywordtype">int</span>)sqlR[<span class="stringliteral">&quot;IdNewsletter&quot;</span>], (<span class="keywordtype">string</span>)sqlR[<span class="stringliteral">&quot;Title&quot;</span>], (<span class="keywordtype">string</span>)sqlR[<span class="stringliteral">&quot;Description&quot;</span>], (<span class="keywordtype">string</span>)sqlR[<span class="stringliteral">&quot;Content&quot;</span>], (DateTime)sqlR[<span class="stringliteral">&quot;NewsDate&quot;</span>], (DateTime)sqlR[<span class="stringliteral">&quot;NewsDateSend&quot;</span>], (<span class="keywordtype">bool</span>)sqlR[<span class="stringliteral">&quot;IsSent&quot;</span>]));
<a name="l00208"></a>00208                 }
<a name="l00209"></a>00209 
<a name="l00210"></a>00210                 sqlR.Close();
<a name="l00211"></a>00211             }
<a name="l00212"></a>00212             <span class="keywordflow">catch</span> (Exception ex)
<a name="l00213"></a>00213             {
<a name="l00214"></a>00214                 ErrorLogger.LogError(ex);
<a name="l00215"></a>00215             }
<a name="l00216"></a>00216             <span class="keywordflow">finally</span>
<a name="l00217"></a>00217             { sqlC.Close(); }
<a name="l00218"></a>00218 
<a name="l00219"></a>00219             <span class="keywordflow">return</span> result;
<a name="l00220"></a>00220         }
<a name="l00221"></a>00221 
<a name="l00226"></a><a class="code" href="class_shop_d_a_o_1_1_newsletter_d_a_o.html#a9fa2d9b520224839c9788b4dde9b2432">00226</a>         <span class="keyword">public</span> Dictionary&lt;int, Newsletter&gt; <a class="code" href="class_shop_d_a_o_1_1_newsletter_d_a_o.html#a9fa2d9b520224839c9788b4dde9b2432" title="Pobiera id wiadomości kótrych data wysłania juz mineła/nastała (Downloads id...">GetNewsletterToSend</a>()
<a name="l00227"></a>00227         {
<a name="l00228"></a>00228             SqlConnection sqlC = Connection();
<a name="l00229"></a>00229             SqlCommand command = sqlC.CreateCommand();
<a name="l00230"></a>00230             SqlDataReader sqlR;
<a name="l00231"></a>00231             Dictionary&lt;int, Newsletter&gt; result = <span class="keyword">new</span> Dictionary&lt;int, Newsletter&gt;();
<a name="l00232"></a>00232 
<a name="l00233"></a>00233             command.CommandText = <span class="stringliteral">&quot;GetNewsletter&quot;</span>;
<a name="l00234"></a>00234             command.CommandType = CommandType.StoredProcedure;
<a name="l00235"></a>00235 
<a name="l00236"></a>00236             command.Parameters.Add(<span class="keyword">new</span> SqlParameter(<span class="stringliteral">&quot;@ToSend&quot;</span>, <span class="keyword">true</span>));
<a name="l00237"></a>00237 
<a name="l00238"></a>00238             <span class="keywordflow">try</span>
<a name="l00239"></a>00239             {
<a name="l00240"></a>00240                 sqlC.Open();
<a name="l00241"></a>00241                 sqlR = command.ExecuteReader();
<a name="l00242"></a>00242 
<a name="l00243"></a>00243                 <span class="keywordflow">while</span> (sqlR.Read())
<a name="l00244"></a>00244                 {
<a name="l00245"></a>00245                     result.Add((<span class="keywordtype">int</span>)sqlR[<span class="stringliteral">&quot;IdLanguage&quot;</span>], <span class="keyword">new</span> <a class="code" href="class_shop_model_1_1_newsletter.html" title="Klasa przechowująca informacje o biuletynie (Newsletter) wysyłanym do użytkowników...">Newsletter</a>((<span class="keywordtype">int</span>)sqlR[<span class="stringliteral">&quot;IdNewsletter&quot;</span>], (<span class="keywordtype">string</span>)sqlR[<span class="stringliteral">&quot;Title&quot;</span>], (<span class="keywordtype">string</span>)sqlR[<span class="stringliteral">&quot;Description&quot;</span>], (<span class="keywordtype">string</span>)sqlR[<span class="stringliteral">&quot;Content&quot;</span>], (DateTime)sqlR[<span class="stringliteral">&quot;NewsDate&quot;</span>], (DateTime)sqlR[<span class="stringliteral">&quot;NewsDateSend&quot;</span>], (<span class="keywordtype">bool</span>)sqlR[<span class="stringliteral">&quot;IsSent&quot;</span>]));
<a name="l00246"></a>00246                 }
<a name="l00247"></a>00247 
<a name="l00248"></a>00248                 sqlR.Close();
<a name="l00249"></a>00249             }
<a name="l00250"></a>00250             <span class="keywordflow">catch</span> (Exception ex)
<a name="l00251"></a>00251             {
<a name="l00252"></a>00252                 ErrorLogger.LogError(ex);
<a name="l00253"></a>00253             }
<a name="l00254"></a>00254             <span class="keywordflow">finally</span>
<a name="l00255"></a>00255             { sqlC.Close(); }
<a name="l00256"></a>00256 
<a name="l00257"></a>00257             <span class="keywordflow">return</span> result;
<a name="l00258"></a>00258         }
<a name="l00259"></a>00259 
<a name="l00265"></a><a class="code" href="class_shop_d_a_o_1_1_newsletter_d_a_o.html#a6b5d73fd3b9da55785bf1d5756e7ed33">00265</a>         <span class="keyword">public</span> List&lt;NewsletterEmail&gt; <a class="code" href="class_shop_d_a_o_1_1_newsletter_d_a_o.html#a6b5d73fd3b9da55785bf1d5756e7ed33" title="Pobiera maile na które należy wysłać wiadomośc z tabeli NewsLetterEmail (Downloads...">GetNewsletterMailingList</a>(<span class="keywordtype">int</span> NewsletterID, <span class="keywordtype">int</span> Count)
<a name="l00266"></a>00266         {
<a name="l00267"></a>00267             SqlConnection sqlC = Connection();
<a name="l00268"></a>00268             SqlCommand command = sqlC.CreateCommand();
<a name="l00269"></a>00269             SqlDataReader sqlR;
<a name="l00270"></a>00270             List&lt;NewsletterEmail&gt; result = <span class="keyword">new</span> List&lt;NewsletterEmail&gt;();
<a name="l00271"></a>00271 
<a name="l00272"></a>00272             command.CommandText = <span class="stringliteral">&quot;GetNewsletterMailingList&quot;</span>;
<a name="l00273"></a>00273             command.CommandType = CommandType.StoredProcedure;
<a name="l00274"></a>00274 
<a name="l00275"></a>00275             command.Parameters.Add(<span class="keyword">new</span> SqlParameter(<span class="stringliteral">&quot;@NewsletterID&quot;</span>, NewsletterID));
<a name="l00276"></a>00276             command.Parameters.Add(<span class="keyword">new</span> SqlParameter(<span class="stringliteral">&quot;@Count&quot;</span>, Count));
<a name="l00277"></a>00277 
<a name="l00278"></a>00278             <span class="keywordflow">try</span>
<a name="l00279"></a>00279             {
<a name="l00280"></a>00280                 sqlC.Open();
<a name="l00281"></a>00281                 sqlR = command.ExecuteReader();
<a name="l00282"></a>00282 
<a name="l00283"></a>00283                 <span class="keywordflow">while</span> (sqlR.Read())
<a name="l00284"></a>00284                     result.Add(<span class="keyword">new</span> <a class="code" href="class_shop_model_1_1_newsletter_email.html" title="Klasa przechowująca adres email użytkownika oraz id wiadomości do wysłania (Class...">NewsletterEmail</a>((<span class="keywordtype">int</span>)sqlR[<span class="stringliteral">&quot;IdNews&quot;</span>], (<span class="keywordtype">string</span>)sqlR[<span class="stringliteral">&quot;Email&quot;</span>], (<span class="keywordtype">int</span>)sqlR[<span class="stringliteral">&quot;PrefferedlanguageID&quot;</span>]));
<a name="l00285"></a>00285 
<a name="l00286"></a>00286                 sqlR.Close();
<a name="l00287"></a>00287             }
<a name="l00288"></a>00288             <span class="keywordflow">catch</span> (Exception ex)
<a name="l00289"></a>00289             {
<a name="l00290"></a>00290                 ErrorLogger.LogError(ex);
<a name="l00291"></a>00291             }
<a name="l00292"></a>00292             <span class="keywordflow">finally</span>
<a name="l00293"></a>00293             { sqlC.Close(); }
<a name="l00294"></a>00294 
<a name="l00295"></a>00295             <span class="keywordflow">return</span> result;
<a name="l00296"></a>00296         }
<a name="l00297"></a>00297 
<a name="l00298"></a>00298     }
<a name="l00299"></a>00299 }
</pre></div></div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&nbsp;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&nbsp;</span>Klasy</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&nbsp;</span>Przestrzenie nazw</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&nbsp;</span>Pliki</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&nbsp;</span>Funkcje</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&nbsp;</span>Zmienne</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&nbsp;</span>Wyliczenia</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&nbsp;</span>Właściwości</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&nbsp;</span>Zdarzenia</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr size="1"/><address style="text-align: right;"><small>Wygenerowano Mon Nov 9 06:08:17 2009 dla eCommerce programem&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>
